package com.mincko.minckotest;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;

import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;
import com.mincko.minckotest.shared.Image;

public final class PMF {
    private static final PersistenceManagerFactory pmfInstance =
        JDOHelper.getPersistenceManagerFactory("transactions-optional");

    private static Objectify ofy;
    
    private PMF() {}

    public static PersistenceManagerFactory get() {
        return pmfInstance;
    }
    
    public static Objectify getObjectify()
    {
    	if (ofy == null){
    		ofy = ObjectifyService.begin();
    		ObjectifyService.register(Image.class);
    	}
    	
    	return ofy;
    }
    
}